<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html:html lang="true">
<head>
	<html:base />

	<title>花艺论坛_佩华花艺学校</title>

	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />
	<meta http-equiv="keywords" content="" />
	<meta http-equiv="description" content="This is my page" />
	<script type="text/javascript" src="<%=request.getContextPath()%>/js/base.js"></script>
	<script type="text/javascript"
		src="<%=request.getContextPath()%>/plugin/jScrollPane/jquery/jquery-1.2.6.min.js"></script>
	<script type="text/javascript"
		src="<%=request.getContextPath()%>/plugin/jScrollPane/jquery/jquery.mousewheel.js"></script>
	<script type="text/javascript"
		src="<%=request.getContextPath()%>/plugin/jScrollPane/jquery/jquery.em.js"></script>
	<script type="text/javascript"
		src="<%=request.getContextPath()%>/plugin/jScrollPane/js/jScrollPane.js"></script>
	<link rel="stylesheet" type="text/css" media="all"
		href="<%=request.getContextPath()%>/plugin/jScrollPane/css/demoStyles.css" />
	<link rel="stylesheet" type="text/css" media="all"
		href="<%=request.getContextPath()%>/plugin/jScrollPane/css/jScrollPane.css" />
	<link href="<%=request.getContextPath()%>/css/black/style.css"
		rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/interface/ImageUtils.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/engine.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/util.js"></script>
	<script type="text/javascript"> 
		$(function()
		{
			$('#post_list').jScrollPane({showArrows:true});
		});
		function validate(){
			return validateEmpty(new Array("title", "content"
			<c:if test="${sessionScope.userForm==null}">
				, "kaptchafield"
			</c:if>
			));
		}
		function insertPhoto(){
			var src = prompt('请输入图片URL','http://');
			if(src != null){
				var reply = document.getElementById('txt_content');
				ImageUtils.exists(src, function(exists){
					if(!exists) {
						alert('输入图片不存在或者该图片不允许外链');
						return;
					}
					
					ImageUtils.getSize(src, function(imgSize){
						var imgJson = eval('('+imgSize+')');
						if(imgJson.width <= 0 || imgJson.height <= 0) {
							alert('输入图片不存在或者该图片不允许外链');
							return;
						} else {
							if(imgJson.width > imgJson.height){
								reply.value += '<br/><a href="'+src+'" target="_blank"><img src="'+src+'" width="120" height="90" alt="图片" /></a><br/>';
							} else if(imgJson.width<imgJson.height){
								reply.value += '<br/><a href="'+src+'" target="_blank"><img src="'+src+'" width="90" height="120" alt="图片" /></a><br/>';
							} else {
								reply.value += '<br/><a href="'+src+'" target="_blank"><img src="'+src+'" width="100" height="100" alt="图片" /></a><br/>';
							}
						}
					});
				});
			}
		}
	</script>

</head>

<body>
	<div id="content">
		<jsp:include page="/front/layout/header.jsp"></jsp:include>
		<jsp:include page="/front/layout/nav.jsp"></jsp:include>

		<div id="main">
			<div id="mainleft" class="left">
				<div class="m_l_t"></div>
				<div class="m_l_b"></div>
			</div>
			<div id="mainmain" class="left">
				<div id="bbs">
					<!-- 版块列表和帖子列表 -->
					<logic:iterate id="iter" name="boardFormList">
						<!-- 隐藏其他版块列表，只显示当前版块 -->
						<!--
						<c:if test="${iter.id != boardForm.id}">
							<h1 class="colorfff yahei border21">
								<a href="<%=request.getContextPath()%>/front/bbs/board.do?method=postList&id=${iter.id}&parentId=${boardForm.parentId}&searchFlag=1"
									class="light_grey large">${iter.name}</a>&nbsp;&nbsp;&nbsp;&nbsp;
								<a href="<%=request.getContextPath()%>/front/bbs/board.do?method=postList&id=${iter.id}&parentId=${boardForm.parentId}&searchFlag=1"
									class="light_grey small">展开</a>
							</h1>
						</c:if>
						-->
						<c:if test="${iter.id == boardForm.id}">
							<h1 class="colorfff yahei border21">
								<span class="light_grey middle"><a href="<%=request.getContextPath()%>/front/bbs/board.do?method=list&parentId=-1&searchFlag=1" style="font-size:14px;">论坛首页</a> - ${iter.name}</span>&nbsp;&nbsp;&nbsp;&nbsp;
							</h1>
							<ul id="post_list" class="c_list" style="height:200px;">
							<logic:iterate id="iter" name="postFormList">
								<li>
									<a href="<%=request.getContextPath()%>/front/bbs/post.do?method=des&id=${iter.id}&boardId=${boardForm.id}&boardParentId=${boardForm.parentId}&searchFlag=1">${iter.title}</a>
									<span class="time">发帖时间：${iter.createTimeStr}</span>
								</li>
							</logic:iterate>
							<logic:empty name="postFormList">
								<li><span class="white middle">没有任何帖子</span></li>
							</logic:empty>
							</ul>
						</c:if>
					</logic:iterate>
								<div class="pager right">
									<form method="post">
										<input type="hidden" name="id" value="${boardForm.id}" />
										<input type="hidden" name="parentId" value="${boardForm.parentId}" />
										<jsp:include page="/front/layout/page_info_form_front.jsp"></jsp:include>
									</form>
								</div>
				</div>
				
				<!-- 新建帖子对话框 -->
				<div style="margin-top:20px;_margin-top:-20px;">
				<html:form action="/post.do?method=insertLzPost">
					<input type="hidden" name="boardId" value="${boardForm.id}" />
					<input type="hidden" name="boardParentId" value="${boardForm.parentId}" />
					<span class="light_grey small">帖子标题：</span>
					<input type="text" name="title" size="55" />
					<br />
					<span class="light_grey small">帖子内容：</span>
					<br />
					<textarea id="txt_content" name="content" cols="75" rows="3"></textarea>
					<br />
					<a href="javascript:if(validate()) document.forms[1].submit();" style="text-decoration: underline">发 帖</a>
					<a href="javascript:insertPhoto();" style="text-decoration: underline">添加图片</a>&nbsp;
					<c:if test="${sessionScope.userForm==null}">
						<span class="light_grey small">验证码:</span>
						<input type="text" name="kaptchafield" size="6" />
						<img src="<%=request.getContextPath()%>/kaptcha" height="25" width="75" style="margin-bottom:-5px;" />
					</c:if>
				</html:form>
				</div>
				
			</div>
			<div id="mainright" class="right">
				<div class="m_r_t"></div>
				<div class="m_r_b"></div>
			</div>
		</div>
		<jsp:include page="/front/layout/contact.jsp"></jsp:include>
	</div>
</body>
</html:html>
